<template>
    <div>
        <quill-editor class="editor" v-model="content" ref="myQuillEditor" :options="editorOption" @blur="onEditorBlur($event)"
                      @focus="onEditorFocus($event)" @change="onEditorChange($event)">
        </quill-editor>
    </div>
</template>
<script>

    import {
        quillEditor
    } from "vue-quill-editor";
    import "quill/dist/quill.core.css";
    import "quill/dist/quill.snow.css";
    import "quill/dist/quill.bubble.css";
    import utilMethod from '../../utils/utilMethod';

    export default {
        props: {
            /*编辑器的内容*/
            value: {
                type: String
            },
            content:{
                type:String
            }
        },
        components:{
            quillEditor
        },
        data() {
            return {
                content: this.value, //内容
                editorOption: {
                    theme: "snow", //主题 snow/bubble
                    placeholder: "您想说点什么？", //提示
                    readyOnly: false, //是否只读
                    syntax: true //语法检测
                }
            };
        },

        methods: {
            onEditorBlur() {
                //失去焦点事件
            },
            onEditorFocus() {
                //获得焦点事件
            },
            onEditorChange() {
                //内容改变事件
                this.$emit("input", this.content);
            },
        },
        mounted() {
            const that = this;
            utilMethod.$on('success',function() {
                that.content = null;
            })
        }
    };
</script>



